package com.lanou3g.ptp.api.web.controller;

import com.lanou3g.ptp.api.utils.PtpResult;
import com.lanou3g.ptp.api.utils.PtpResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(description = "资源上传")
@RestController
@RequestMapping("/upload")
public class UploadController {

    @ApiOperation(value = "上传图片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "image", value = "图片资源")
    })
    @PostMapping(value = "/image")
    public PtpResult uploadImage(MultipartFile image) {
        String imageSrc = "https://wx3.sinaimg.cn/large/007dOZvply1g2curtd7flj31hc0mz15p.jpg";
        return PtpResultUtils.ok(imageSrc);
    }
}
